<?php 
/**
* 留言板首页
*/
class IndexController extends Controller
{
	
	public function index()
	{

		$sql = "select * from msg t1 inner join user t2 on t1.uid=t2.uid";

		$db = db('msg');

		$msgs = $db->query($sql);
		$this->assign('msgs',$msgs);
	 	$this->display();
	}

	public function add()
	{
		$data = $_POST;

		$data['uid'] = $_SESSION['uid'];

		$data['ctime'] = time();

		db('msg')->add($data);

		header("Location:./index.php");
	}

}

 ?>